home *** CD-ROM | disk | FTP | other *** search
- // string.cpp : Defines the initialization routines for the DLL.
- // High Tech BASIC, Copyright (C) TransEra Corp 1999, All Rights Reserved.
-
- #include "stdafx.h"
- #include "string.h"
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
- //
- // Note!
- //
- // If this DLL is dynamically linked against the MFC
- // DLLs, any functions exported from this DLL which
- // call into MFC must have the AFX_MANAGE_STATE macro
- // added at the very beginning of the function.
- //
- // For example:
- //
- // extern "C" BOOL PASCAL EXPORT ExportedFunction()
- // {
- // AFX_MANAGE_STATE(AfxGetStaticModuleState());
- // // normal function body here
- // }
- //
- // It is very important that this macro appear in each
- // function, prior to any calls into MFC. This means that
- // it must appear as the first statement within the
- // function, even before any object variable declarations
- // as their constructors may generate calls into the MFC
- // DLL.
- //
- // Please see MFC Technical Notes 33 and 58 for additional
- // details.
- //
-
- /////////////////////////////////////////////////////////////////////////////
- // CStringApp
-
- BEGIN_MESSAGE_MAP(CStringApp, CWinApp)
- //{{AFX_MSG_MAP(CStringApp)
- // NOTE - the ClassWizard will add and remove mapping macros here.
- // DO NOT EDIT what you see in these blocks of generated code!
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // CStringApp construction
-
- CStringApp::CStringApp()
- {
- // TODO: add construction code here,
- // Place all significant initialization in InitInstance
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // The one and only CStringApp object
-
- CStringApp theApp;
-
-
-
- extern "C"
- {
-
-
-
- /////////////////////////////////////////////////////////////////////////////
- /*
- Function: Append
-
- Description: append one string to another
-
- Return type: char* _cdecl
- Argument: char* str1
- Argument: char* str2
-
- Notes:
-
- */
- char* _cdecl Append(char* str1, char* str2)
- { AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- return(strcat(str1,str2));
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- /*
- Function: FindChar
-
- Description: return pointer to first instance of given character
-
- Return type: char* _cdecl
- Argument: char* str
- Argument: char c
-
- Notes:
-
- */
- char* _cdecl FindChar(char* str, char c)
- { AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- return(strchr(str,c));
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- /*
- Function: CopyString
-
- Description: copy the contents of one string into another
-
- Return type: char* _cdecl
- Argument: char* str1
- Argument: char* str2
-
- Notes:
-
- */
- char* _cdecl CopyString(char* str1, char* str2)
- { AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- return(strcpy(str1,str2));
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- /*
- Function: FindFromSet
-
- Description: returns an integer value specifying the length of the initial segment of string
- that consists entirely of characters not in str2. If string begins with a
- character that is in str2, the function returns 0.
-
- Return type: short _cdecl
- Argument: char* str1
- Argument: char* str2
-
- Notes:
-
- */
- short _cdecl FindFromSet(char* str1,char* str2)
- { AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- return(strcspn(str1,str2));
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- /*
- Function: CompareLower
-
- Description: compares lowercase versions of str1 and str2.
- if the return is 0 then the strings are the same. if the return is negative
- then str1 is less than str2. if the return is positive then str1 > str2
-
-
- Return type: short _cdecl
- Argument: char* str1
- Argument: char* str2
-
- Notes:
-
- */
- short _cdecl Compare(char* str1,char* str2)
- { AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- return(stricmp(str1,str2));
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- /*
- Function: AppendCount
-
- Description: appends first count characters of str2 to the end of str1.
-
- Return type: char* _cdecl
- Argument: char* str1
- Argument: char* str2
- Argument: short count
-
- Notes:
-
- */
- char* _cdecl AppendCount(char* str1,char* str2,short count)
- { AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- return(strncat(str1,str2,count));
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- /*
- Function: CopyStringCount
-
- Description: copies the first count characters of str2 into str1
-
- Return type: char* _cdecl
- Argument: char* str1
- Argument: char* str2
- Argument: short count
-
- Notes:
-
- */
- char* _cdecl CopyStringCount(char* str1,char* str2,short count)
- { AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- return(strncpy(str1,str2,count));
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- /*
- Function: CompareStringCount
-
- Description: compares the first count characters of lowercase versions of str1 and str2
- if the return is 0 then the strings are the same. if the return is negative
- then str1 is less than str2. if the return is positive then str1 > str2
-
- Return type: short _cdecl
- Argument: char* str1
- Argument: char* str2
- Argument: short count
-
- Notes:
-
- */
- short _cdecl CompareStringCount(char* str1,char* str2,short count)
- { AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- return(strnicmp(str1,str2,count));
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- /*
- Function: GetFromSet
-
- Description: returns a pointer to the first character in str1 that exists in str2
-
- Return type: char* _cdecl
- Argument: char* str1
- Argument: char* str2
-
- Notes:
-
- */
- char* _cdecl GetFromSet(char* str1,char* str2)
- { AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- return(strpbrk(str1,str2));
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- /*
- Function: Reverse
-
- Description: reverses the string
-
- Return type: char* _cdecl
- Argument: char* str
-
- Notes:
-
- */
- char* _cdecl Reverse(char* str)
- { AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- return(strrev(str));
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- /*
- Function: FindSub
-
- Description: returns a pointer to the first occurance of str2 in str1
-
- Return type: char* _cdecl
- Argument: char* str1
- Argument: char* str2
-
- Notes:
-
- */
- char* _cdecl FindSub(char* str1,char* str2)
- { AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- return(strstr(str1,str2));
- }
-
-
- } // end extern "C"